### SCPI Command Structure and Syntax

SCPI commands consist of a so-called header and, in most cases, one or more parameters. The header and the parameters are separated by a "white space" (ASCII code 0 to 9, 11 to 32 decimal, e.g. blank). The headers may consist of several key words. Queries are formed by directly appending a question mark to the header.

Common commands
and device-specific commands
differ in their syntax.

#### Common Commands

Common (=device-independent) commands consist of a header preceded by an asterisk "*" and possibly one or more parameters.

Examples:
*RST | RESET, resets the instrument.
*ESE 253 | EVENT STATUS ENABLE, sets the bits of the event status enable registers.
*ESR? | EVENT STATUS QUERY, queries the contents of the event status register.

#### Device-Specific Commands

Device-specific commands are of hierarchical structure. The different levels are represented by combined headers. Headers of the highest level (root level) have only one key word. This key word denotes a complete command system.

Example: SENSe This mnemonic denotes the command system SENSe. For commands of lower levels, the complete path has to be specified, starting on the left with the highest level, the individual key words being separated by a colon ":".
Example: SENSe:FREQuency:STARt 1GHZ This command is located on the third level of the SENSe system. It defines the start frequency of the sweep.

The following rules simplify and abbreviate the command syntax:

- Multiple mnemonics

  Some mnemonics occur on several levels within one command system. Their effect depends on the structure of the command, i. e. on the position in the command header they are inserted in.

  Example:
  SOURce:FREQuency:CW lGHZ

  This command contains the key word SOURce in the first command level. It defines the frequency for sweep types operating at fixed frequency.

  TRIGger:SOURce EXTernal

  This command contains the key word SOURce in the second command level. It defines the trigger source “external trigger”.

- Optional mnemonics

  Some command systems permit certain mnemonics to be optionally inserted into the header or omitted. These mnemonics are marked by square brackets in this manual. The full command length must be recognized by the instrument for reasons of compatibility with the SCPI standard. Some commands are considerably shortened by omitting optional mnemonics.

  Example:
  TRIGger[:SEQuence]:SOURce EXTernal

  This command defines the trigger source “external trigger”. The following command has the same effect:

  TRIGger:SOURce EXTernal

  An optional mnemonic must not be omitted if its effect is additionally specified by a numeric suffix.

- Long and short form

  The key words feature a long form and a short form. Either the short form or the long form can be entered; other abbreviations are not permitted.

  Example:
  TRIGger:SOURce EXTernal
  TRIG:SOUR EXT

  The short form is marked by upper case letters, the long form corresponds to the complete word. Upper case and lower case notation only serves to distinguish the two forms in the manual, the instrument itself is case-insensitive.

- Parameters

  Parameters must be separated from the header by a "white space". If several parameters are specified in a command, they are separated by a comma ",". For a description of the types of parameter, refer to section Parameters.

  Example:
  SOURce:GROup 1,1

  This command defines a group of measured ports.

- Numeric suffix

  If a device features several functions or features of the same kind, e.g. several channels or test ports, the desired function can be selected by a suffix added to the command. Entries without suffix are interpreted like entries with the suffix 1.

  Example:
  SOURce:GROup2 1,1

  This command defines a second group (group no 2) of measured ports.

#### Structure of a Command Line

A command line may consist of one or several commands. It is terminated by a <New Line>, a <New Line> with EOI or an EOI together with the last data byte. Visual BASIC automatically produces an EOI together with the last data byte.

Several commands in a command line must be separated by a semicolon ";". If the next command belongs to a different command system, the semicolon is followed by a colon.

Example: CALL IBWRT(device%, "TRIGger:SOURce EXTernal;:SENSe:FREQuency:STARt 1GHZ")

This command line contains two commands. The first command belongs to the TRIGger system and defines the trigger source (external trigger). The second command belongs to the SENSe system and defines the start frequency of the sweep.

If the successive commands belong to the same system, having one or several levels in common, the command line can be abbreviated. To this end, the second command after the semicolon starts with the level that lies below the common levels. The colon following the semicolon must be omitted in this case.

Example: CALL IBWRT(device%, "TRIG:SOUR EXT;:TRIG:TIM 0.1")

This command line is represented in its full length and contains two commands separated from each other by the semicolon. Both commands are part of the TRIGger command system, i.e. they have one level in common.

When abbreviating the command line, the second command begins with the level below TRIG. The colon after the semicolon is omitted. The abbreviated form of the command line reads as follows:

CALL IBWRT(device%, "TRIG:SOUR EXT; TIM 0.1")

However, a new command line always begins with the complete path.

Example: | CALL IBWRT(device%, "TRIG:SOUR EXT ") CALL IBWRT(device%, "TRIG:THR LOW ")

### Responses to Queries

A query is defined for each setting command unless explicitly specified otherwise. It is formed by adding a question mark to the associated setting command. According to SCPI, the responses to queries are partly subject to stricter rules than in standard IEEE 488.2.

1. The requested parameter is transmitted without header.
Example: TRIGger:SOURce? Response: IMM

2. Maximum values, minimum values and all further quantities which are requested via a special text parameter are returned as numerical values.
Example: SENSe:FREQuency:STOP? MAX Response: 8000000000

3. Numerical values are output without their unit. The default unit for each command is reported in the SCPI command description
.
Example: SENSe:FREQuency:STOP? MAX Response: 8000000000 for 8 GHz

4. Boolean values are returned as 0 (for OFF) and 1 (for ON).
Example: SWEep:TIME:AUTO? Response: 1

5. Text (character data) is returned in short form (see also next section).
Example: TRIGger:SOURce? Response: IMM